package com.object;

import maps.test.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;

import android.view.Gravity;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class MyCustomisedViewToast extends RelativeLayout {
	int height;
	int width;

	public MyCustomisedViewToast(final Context context, String text) {
		super(context);
		LinearLayout.LayoutParams layoutparams = new LinearLayout.LayoutParams(
				android.view.ViewGroup.LayoutParams.FILL_PARENT,
				android.view.ViewGroup.LayoutParams.FILL_PARENT);
		this.setLayoutParams(layoutparams);
		this.setBackgroundColor(Color.TRANSPARENT);

		LinearLayout layoutF1 = new LinearLayout(context);
		layoutF1.setOrientation(LinearLayout.HORIZONTAL);
		layoutparams = new LinearLayout.LayoutParams(
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 8);
		layoutF1.setLayoutParams(layoutparams);
		layoutF1.setBackgroundColor(Color.TRANSPARENT);
		layoutF1.setGravity(CENTER_IN_PARENT);

		LinearLayout layoutF11 = new LinearLayout(context);
		layoutF11.setOrientation(LinearLayout.HORIZONTAL);
		layoutparams = new LinearLayout.LayoutParams(
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 40);
		layoutF11.setLayoutParams(layoutparams);
		layoutF11.setBackgroundDrawable(((Activity) context).getResources()
				.getDrawable(R.drawable.toast_layout_bg));
		// android:layout_below="@+id/cutomize_layout_fake"
		layoutF11.setGravity(BELOW);
		layoutF11.setGravity(CENTER_IN_PARENT);

		TextView textView = new TextView(context);
		layoutparams = new LinearLayout.LayoutParams(
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
				android.view.ViewGroup.LayoutParams.FILL_PARENT);
		textView.setLayoutParams(layoutparams);
		textView.setBackgroundColor(Color.WHITE);
		textView.setText(text);
		textView.setGravity(Gravity.LEFT);
		textView.setGravity(Gravity.CENTER);
		layoutF11.addView(textView);

		ImageButton imageButton = new ImageButton(context);
		imageButton.setBackgroundDrawable(((Activity) context).getResources()
				.getDrawable(R.drawable.toast_image_botton));
		imageButton.setBackgroundColor(Color.TRANSPARENT);
		layoutparams = new LinearLayout.LayoutParams(
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
				android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
		imageButton.setLayoutParams(layoutparams);
		// android:gravity="center|right"/>
		layoutF11.addView(imageButton);
		layoutF1.addView(layoutF11);
		this.addView(layoutF1);

	}

}
